package lex.mxbeans;

import javax.swing.JFrame;

import org.lex.app.Application;
import org.lex.swing.Swings;

import lex.mxbeans.ui.MainContentPane;

public class MXBeans extends Application
{
	public static void main( String[] args )
	{
		Swings.setUseBoldMetalFont( false );
		Application.launch( MXBeans.class, args );
	}
	
	public static MXBeans getApplication()
	{
		return Application.getApplication( MXBeans.class );
	}

	private JFrame mainframe = null;
	private MainContentPane contentPane = null;

	@Override
	public String getApplicationID()
	{
		return "mxbeans";
	}

	@Override
	public JFrame getRootWindow()
	{
		if( null == mainframe )
		{
			mainframe = new JFrame();
			mainframe.setName( getClass().getName() + ".mainframe" );
			mainframe.setTitle( "MXBeans" );
			mainframe.setContentPane( this.getContentPane() );
		}
		return mainframe;
	}

	public MainContentPane getContentPane()
	{
		if( null == contentPane )
		{
			contentPane = new MainContentPane();
		}
		return contentPane;
	}

	@Override
	protected void initialize( String[] args )
	{
		this.getContext().getSessionStorage().restore( this.getRootWindow() );
		this.mainframe.setVisible( true );
	}

	@Override
	protected void shutdown()
	{
		this.getContentPane().removeAll();
		this.getContext().getSessionStorage().save( this.getRootWindow() );
	}
	
	
}
